package dpss.commons;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Util {

	/**
	 * Loads a properties from file
	 * @param path
	 * @return
	 */
	public static Properties loadProperties(String path){
		Properties prop = new Properties();
		InputStream input = null;
		try {
			input = new FileInputStream(path);
			prop.load(input);
		} catch (IOException ex) {
			ex.printStackTrace();
		} finally {
			if (input != null) {
				try {
					input.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return prop;
	}
	
	/**
	 * Prints the program name on start
	 */
	public static void printProgramName(String programName){
		System.out.println(
				"==================================================\n"+
			    "--------------------------------------------------\n\n"+
				"<<<<< "+programName.toUpperCase()+" >>>>>\n\nDeveloped by Musab M. Mirza and Shewtaank Indora\n"+
				"--------------------------------------------------\n"+
				"==================================================\n\n");
	}
	
}
